﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FastestWays.Model;
using GalaSoft.MvvmLight;

namespace FastestWays.ViewModel
{
    public class SettingsViewModel : ViewModelBase
    {
        public SettingsViewModel()
        {
            LocationServicesActivated = Parameters.IsLocationServiceOn;
            this.PropertyChanged += OnPropertyChanged;
        }

        private void OnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
        {
            if (propertyChangedEventArgs.PropertyName == "LocationServicesActivated")
            {
                Parameters.IsLocationServiceOn = LocationServicesActivated;
            }
        }

        private bool _locationServicesActivated;

        public bool LocationServicesActivated
        {
            get { return _locationServicesActivated; }
            set
            {
                _locationServicesActivated = value;
                RaisePropertyChanged("LocationServicesActivated");
            }
        }
    }
}
